<html>
    <head>
        <title>Smallest Common Multiple</title>
        <!-- // <script src="../lib/jquery-1.11.2.min.js" type="text/javascript"></script> -->
    </head>
    <body>
        <script type="text/javascript">
            function smallestCommons(arr) {
                var max = Math.max(arr[0],arr[1]),
                    min = Math.min(arr[0],arr[1]);
                var r = min;
                for (var i = min; i < max+1; i++) {
                    r = calcTWO(r,i);
                };
                console.log(r);
                return r;
            }
            function calcTWO(a,b){
                var min = Math.min(a,b);
                if(a>b){
                    b = a;
                    a = min;
                }
                while(a%b!=0){
                    a = a + min;
                }
                return a;
            }


            smallestCommons([1,5]);
        </script>
    </body>
</html>